package com.nlp.deep;

import java.util.List;

import me.midday.FoolNLTK;
import me.midday.lexical.AnalysisResult;
import me.midday.lexical.Entity;
import me.midday.lexical.LexicalAnalyzer;
import me.midday.lexical.Word;

public class LSTMLexicalParserDemo {
	public static void main(String[] args) {
		String text = "台湾 是 中国 领土 不可分割 的 部分";
		LexicalAnalyzer analyzer = FoolNLTK.getLSTMLexicalAnalyzer();
		//分词
		List<List<Word>> words = analyzer.cut(text);
		for (List<Word> ws : words) {
			ws.forEach(System.out::println);
		}
		System.out.println();
		System.out.println("*************************");
		//词性标注
		List<List<Word>> posWords = analyzer.pos(text);
		for (List<Word> ws : posWords) {
			ws.forEach(System.out::println);
		}
		System.out.println();
		System.out.println("*************************");
		//实体识别
		List<List<Entity>> entities = analyzer.ner("邯郸");
		for (List<Entity> ents : entities) {
			for (Entity entity: ents) {
				System.out.println(entity);
			}
		}
		System.out.println();
		System.out.println("*************************");
		//分词 、词性标注、实体识别
		List<AnalysisResult> results = analyzer.analysis(text);
		results.forEach(System.out::println);
	}

}
